<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>课表</title>
    <meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0.maximum-scale=1.0,user-scalable=no" name="viewport">
	<!-- <link rel="stylesheet" href="css/weui.min.css"> -->
	<link rel="stylesheet" href="coach/css/jquery-weui.css">
	<link rel="stylesheet" href="coach/css/reset.css">
	<link rel="stylesheet" href="coach/css/homePage.css">
	<link rel="stylesheet" href="coach/css/flexible.css">
	<link rel="stylesheet" href="coach/css/vant.css">
	<link rel="stylesheet" href="coach/css/mobiscroll.custom-3.0.0-beta6.min.css">
	<script src="coach/js/jquery.min.js"></script>
	<script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
	<script src="coach/js/flexible.js"></script>
	<script src="coach/js/vue/vue.js"></script>
    <script src="coach/js/vue/axios.js"></script>
    <script src="coach/js/vue/MD5.js"></script>
    <script src="coach/js/vue/qs.js"></script>
	<script src="coach/js/vue/vant.js"></script>
	<script src="coach/js/mobiscroll.custom-3.0.0-beta6.min.js"></script>
	<script src="coach/js/main.js"></script>
	<style>
		.time_header{
			line-height: 80px;
			border:1px solid #f8f8f8;
			text-align:center;
			color:#6B6771;
		}
		.time_header_span{
			width:9%;
			display:inline-block;
			text-align:center;
			color:#6B6771;
			height: 30px;
			line-height: 30px;
		}
		.time_header_span_week{
			width: 78px;
			display:inline-block;
			text-align:center;
			color:#6B6771;
			height: 30px;
			line-height: 30px;
		}
		.color_background{
				text-align:center;
				cursor: pointer;
		}
		.color_background p{
			color:#fff;
		}
		.color_background p:nth-child(1){
			width: 90%;
			overflow:hidden;
			text-overflow:ellipsis;
			white-space:nowrap;
		}
		.color_back{
			text-align:center;
			color:#6B6771;
		}
		.week_color{
			color: #1F61EC !important;
		}
		.tabel_hearder{
			width: 644px;
		}
		.tabel_img_time{
			width:80px;
			display: inline-block;
			text-align: center;
			position: relative;
		}
		.courseDate_input_time{
			position: absolute;
			right: 0;
			top: 0.08rem;
			width: 80px;
			height:20px;
			opacity: 0;
			z-index: 10;
		}
		.textBottom{
			text-align: center;
			color: #999999;
			font-size: 14px;
			opacity: 0.4;
			margin-top:50px;
		}
		.nav{
			padding-bottom: 15px;
			border-bottom: 1px solid #f3f3f3;
		}
		.shareCoach{
			position: fixed;
			bottom: 0rem;
			left:0rem;
			height: 6rem;
			width: 100%;
			background:#fff;
		}
		.course_tar{
			padding-top: 2rem;
		}
		.shareCoach>div{
			float: left;
		}
		.shareCoach>div img{
			width: 4.5rem;
		}
		.erweima{
			margin-left: 0.8rem;
		}
		.erweima p{
			color: #0E9CFA;
			font-size: .55rem;
			text-align: center;
		}
		.shareSm{
			margin-top: 0.7rem;
			margin-left: 0.5rem;
		}
		.shareSm p:nth-child(1){
			height: 0.8rem;
			line-height: 0.8rem;
			font-size: 0.6rem;
		}
		.shareSm p:nth-child(1) span{
			color: #0E9CFA;
			font-size: 0.55rem;
		}
		.shareSm p:nth-child(2){
			margin-top: 1rem;
			height: 0.8rem;
			line-height: 0.8rem;
			font-size: 0.8rem;
			font-weight: 600;
		}
		.container_box{
			padding-bottom: 6rem;
		}
	</style>
</head>
<body>
<div id="app">
	<div  class="container_box" style="font-size:14px;">
		<template>
			<div class="tar_qh fk_content course_tar" style="padding-top: 1rem;">
				<ul class="nav">
					<li @click="tar_qh(index)" v-for="(item,index) in tarList"><span :class="{selected:currIndex==index}">{{item.name}}</span></li>
				</ul>
				<div class="content" style="margin-top:10px;overflow: scroll;">
					<div  id="ydateContainer" style="width: 644px;">
						<div>
							<div class="tabel_hearder">
								<span class="tabel_img_time">
									<img src="coach/images/calendar_icon.png">
									<input class="courseDate_input_time" id="age" inputreadonly="true" readonly="readonly">
								</span>
								<span class="time_header_span_week"  v-for="item in weeklist"
								:key="item.day">{{item.week}} (<span class="week_color">{{item.day}}</span>)</span>
							</div>
						<div>
						<div style="float:left;width:78px">
							<div v-for="item_day in datelist" :key="item_day.id" class="time_header" >
								<div v-if="item_day.currlist.length>1" :style="{'line-height':item_day.currlist.length*81+'px'}">{{item_day.Stime}}</div>
								<div v-else>{{item_day.Stime}}</div>
							</div>
						</div>
						<div style="float:left;width:560px;">
								<div v-for="item_week in datelist" :key="item_week.index" class="week_fk">
									<div v-for="item_day in item_week.currlist" :key="item_day.index">
										<div  v-for="item_days in item_day" :key="item_days.index" style="width:78px;float: left;padding-top:10px;border:1px solid #f8f8f8;height:70px;">
											<div  v-if="Array.isArray(item_days)">
											</div>
											<div v-else-if="item_days.Color!=null" class="color_background" :style='{background:item_days.Color}'
											>
												<p style="width: 100%;display: flex;"> {{item_days.Title}}</p>
												<p style="font-size: 12px;"> {{item_days.Stime}}-{{item_days.Etime}}</p>
												<p>{{item_days.Sname}}</p>
											</div>
											<div v-else class="color_back" >
												<p style="overflow: hidden;white-space: nowrap;"> {{item_days.Title}}</p>
												<p> {{item_days.Stime}}-{{item_days.Etime}}</p>
												<p>{{item_days.Sname}}</p>
											</div>
										</div>
									</div>
								</div>
							</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div style="display: none;">
				<input ref="desc" id="desc"/>
				<input ref="descTitle" id="descTitle"/>
				<input ref="descImg" id="descImg"/>
			</div>
		</template>
		<div class="textBottom">馆家提供技术支持</div>
	</div>
	<div class="shareCoach">
		<div class="erweima">
			<img src="coach/images/zihai.jpg"/>
			<p>关注资海云馆家</p>
		</div>
		<div class="shareSm">
			<p @click="memberClick">了解更多课程安排，<span>点这里~</span></p>
			<p>为场馆赋能 助体育人增收</p>
		</div>
	</div>
</div>
</body>
<script src="js/jquery-weui.js"></script>
<script>
var vm=new Vue({
	el: '#app',
	data: {
		show:false,
		ctype:'0',
		ontime:'',
		weeklist:[],
		datelist:[],
		tarList:[{name:"团课"},{
			name:"私课"
		}],
		currIndex:'0',
		vid:'',
		share:'',
		from:{
			ontime:'',
			ctype:''
		}
	},
	created(){
		this.setCanS()
	},
	methods:{
		//设置参数
		setCanS(){
			let Request = new Object()
			Request = GetRequest()
			this.ctype = Request['ctype']
			this.share = Request['type']
			this.vid = Request['vid']
			this.from.ontime = Request['ontime']
			this.from.ctype = Request['ctype']
			sessionStorage.setItem('logo','0')
			sessionStorage.setItem('vid',this.vid)
			this.getToken()

		},
		//获取我预约的课程
		getList(date){
			getVs()
			const params={
				ctype:this.ctype,
				ontime:date
			}
			axios.get('/mobileapi/curriculum_table.php?act=week_table',{params:params}).then(data =>{
				console.log(data.data)
				let { msg, code,user} = data.data
					if (code !== 200) {
						window.vant.Toast.fail(msg)
					} else {
						data=data.data
						this.weeklist=data.data.weeklist
						this.datelist=data.data.datelist
					}
				}).catch(function (error) {
					console.log(error);
			});
		},
		tar_qh(index){
			this.ctype=index
			this.currIndex=index
			let date=''
			this.getList(date)
		},
		//判断是否是分享出去的
		 //获取分享的token
		getToken(){
			const params={
				vid:this.vid
			}
			sessionStorage.setItem('logo','0')
			axios.get('/mobileapi/token.php?act=gettoken',{params:params}).then(data =>{
				console.log(data)
				let { msg, code,user} = data.data
					if (code !== 200) {
						window.vant.Toast.fail(msg)
					} else {
						sessionStorage.setItem('token',data.data.Gtoken)
						this.wxShare()
						let date=''
						this.getList(date)
					}
				}).catch(function (error) {
					console.log(error);
			});
		},
		//跳转到会员端
		memberClick(){
			window.location.href="https://fitness.guanjialc.com/phone/member/index.html?vid="+sessionStorage.getItem('vid')
		},
		 //获取分享内容接口
		 wxShare(){
                sessionStorage.setItem('logo','0')
                const params={
                    vid:sessionStorage.getItem('vid')
                }
                axios.get('/mobileapi/member/wxfx.php?act=get_index_fx',{params:params}).then(data =>{
                    console.log(data.data)
                    let { msg, code,user} = data.data
                        if (code !== 200) {
                            window.vant.Toast.fail(msg)
                        } else {
                            data=data.data
                            this.$refs.desc.value=data.data.desc
                            this.$refs.descTitle.value=data.data.title
                            this.$refs.descImg.value=data.data.picurl
                        }
                    }).catch(function (error) {
                        console.log(error);
                });
            }
        }
	})
$('#age').mobiscroll().date({
    theme: 'mobiscroll',
    display: 'bottom',
    lang: 'zh',
    defaultValue:new Date(),
    dateFormat: 'yyyy-mm-dd',
    startYear:1940,
    endYear:2025,
    onClose(){
        if($("#age").val()!=""){
            var date=$("#age").val();
            vm.getList(date);
        }
    }
});
</script>
</html>
